package panel.eating
{
	import assists.ButtonUtils;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.display.Stage;
	
	public class RankBtnGroupList extends Sprite
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _uri:URI;
		private var _width:Number;
		private var _height:Number;
		
		private var back:Sprite;
		
		private var btnDataList:Array;
		private var btnBack:Bitmap;
		
		public function RankBtnGroupList(stage:Stage,loader:ResourceLoader,uri:URI,wid:Number,hei:Number)
		{
			_stage = stage;
			_loader = loader;
			_uri = uri;
			_width = wid;
			_height = hei;
			
			btnDataList = [];
			
			initThis();
		}
		
		private function initThis():void
		{
			back = new Sprite;
			this.addChild(back);
			
			btnBack = new _loader.uiManager.btnBack as Bitmap;
			btnBack.width = _width;
			btnBack.height = _height;
			back.addChild(btnBack);
		}
		
		public function changeData(list:Array):void
		{
			btnDataList = list;
			
			for(var i:int = 0;i < btnDataList.length;i++){
				back.addChild(btnDataList[i]);
				btnDataList[i].y = 0;
				btnDataList[i].x = i * btnDataList[i].width;
			}
		}
		
		public function clear():void
		{
			for(var i:int = 0;i < btnDataList.length;i++){
				btnDataList[i].clearThis();
			}
		}
	}
}